<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Axios 案例测试2</title>
		<script src="../js/axios.js"></script>
	</head>
	<body>
	<script>
		/**
		 * 语法：
		 * 		1.参数：axios.post(URL地址,数据对象)
		 * 	    2.注意事项：与axios.get(url,{params:对象})请求写法
		 * */
		let url1 = "http://localhost:8080/axios/saveUser";
		let user1 = {id:100,name:"猫",age:2,sex:"雌猫"}
		axios.post(url1,user1)
		.then(function (promise) {
			console.log(promise.data)
		})

		/**
		 * 业务需求：
		 * 		完成用户的修改操作，将id=100的数据  name=张三，age=14，sex=女
		 * 	URL:http://localhost:8080/axios/updateUser
		 * 	返回值：修改成功		数据后端打印
		 * */
		let url2 = "http://localhost:8080/axios/updateUser";
		let user2 = {id:100,name:"张三",age:14,sex:"女"}
		axios.put(url2,user2)
		.then(function (promise) {
			console.log(promise.data);
		})
	</script>
		
		
	</body>
</html>
